module.exports = function(grunt) {

    grunt.initConfig({
        clean: {
            build: ['src/main/webapp/build']
        },
        coffee: {
            compile: {
                expand: true,
                cwd: 'src/main/webapp/coffee/',
                src: ['**/*.coffee'],
                dest: 'src/main/webapp/build/',
                ext: '.js'
            }
        },
        handlebars: {
            compile: {
                expand: true,
                cwd: 'src/main/webapp/template/',
                src: ['**/*.html'],
                dest: 'src/main/webapp/build/template/',
                ext: '.js',
                options: {
                    amd: true,
                    namespace: false
                }
            }
        },
        copy: {
            main: {
                files: [
                    {expand: true, cwd: 'src/main/webapp/', src: ['vendor/**'], dest: 'src/main/webapp/build'}
                ]
            }
        }
    });

    grunt.loadNpmTasks('grunt-contrib-clean');
    grunt.loadNpmTasks('grunt-contrib-coffee');
    grunt.loadNpmTasks('grunt-contrib-handlebars');
    grunt.loadNpmTasks('grunt-contrib-copy');

    grunt.registerTask('build', ['clean', 'copy', 'coffee', 'handlebars']);

};